<template>
  <div>
    <p>count: {{count}}, 当前count为: {{evenOrOdd}}</p>
    <p>count: {{count2}}, 当前count为: {{evenOrOdd2}}</p>
  </div>
</template>

<script>
import {mapState, mapGetters} from 'vuex'
export default {
  name: 'CounterShow',

  computed: {
    /*
    count () {
      return this.$store.state.count
    }, */
    ...mapState(['count']),  // 返回值对象: {'count' () {return this.$store.state['count]}}
    ...mapState({  // 返回值对象: {count2 () {return this.$store.state['count]}}
      count2: 'count'
    }),

    /* evenOrOdd () {
      return this.$store.getters.evenOrOdd
    } */
    ...mapGetters(['evenOrOdd']),  // 返回值对象: {evenOrOdd () {return this.$store.getters.evenOrOdd}}
    ...mapGetters({ // 返回值对象: {evenOrOdd2 () {return this.$store.getters.evenOrOdd}}
      evenOrOdd2: 'evenOrOdd'
    })
  }
}
</script>

<style scoped>

</style>
